import Vue from 'vue'
import {
  mapMutations,
  mapState
} from 'vuex'
import App from './App'
import store from './store'

App.mpType = 'app'
Vue.prototype.$store = store

Vue.mixin({
  methods: {
    ...mapMutations(['changeTab'])
  },
  computed: {
    ...mapState(['sysInfo', 'navbarHeight', 'tabbarHeight']),
    pagePaddingTop() {
      const height = (this.sysInfo.statusBarHeight + this.navbarHeight)
      return `${height}px`
    }
  },
  onShow() {
    if (this.tabIndex !== undefined) {
      this.changeTab(this.tabIndex)
    }
  }
})

const app = new Vue({
  store,
  ...App,
})

app.$mount()